/*
 * menu_config.h
 *
 *  Created on: 24.05.2011
 *      Author: margel
 */

#ifndef MENU_CONFIG_H_
#define MENU_CONFIG_H_

#define MENU_DIALOG		0
#define MENU_RETURN		1
#define MENU_MAIN		2
#define MENU_SETTINGS		3
#define MENU_EXIT		4
#define MENU_CURRENTS		5
#define MENU_PID 		6
#define MENU_CAN 		7

#define MENU_DEXIT_Ok 		8
#define MENU_DEXIT_No 		9
#define MENU_CURRENT1 		10
#define MENU_CURRENT2 		11

#define MENU_TRACK 		12
#define MENU_REGULATION	 13

void menu_select_item(void *arg, char *name);

/*-------------------Menu entries----------------------------------------------------------------------------------*/
menu_t exit_menu =
{
		.top_entry = 0,
		.current_entry = 0,
		.entry =
		{
				{
						.flags = 0,
						.select = menu_select_item,
						.name = "Exit ?",
						.value = ( void * ) MENU_RETURN,
				},
				{
						.flags = 0,
						.select = menu_select_item,
						.name = "Yes",
						.value = ( void * ) MENU_DEXIT_Ok,
				},
				{
						.flags = 0,
						.select = menu_select_item,
						.name = "No",
						.value = ( void * ) MENU_DEXIT_No,
				},
		},
		.num_entries = 3,
		.previous = NULL,
};

menu_t currents_menu =
{
		.top_entry = 0,
		.current_entry = 0,
		.entry =
		{
				{
					.flags = 0,
					.select = menu_select_item,
					.name[0] = 0xAC,
					.name[1] = 0x00,
					.value = ( void * ) MENU_RETURN,
				},
				{
					.flags = 0,
					.select = menu_select_item,
					.name = TXT_CURRENT1,
					.value = ( void * ) MENU_CURRENT1,
				},
				{
					.flags = 0,
					.select = menu_select_item,
					.name = TXT_CURRENT2,
					.value = ( void * ) MENU_CURRENT2,
				},
		},
		.num_entries = 3,
		.previous = NULL,
};

 menu_t settings_menu =
 {
	.top_entry = 0,
	.current_entry = 0,
	.entry =
	{
		{
			.flags = 0,
			.select = menu_select_item,
			.name[0] = 0xAC,
			.name[1] = 0x00,
			.value = ( void * ) MENU_RETURN,
		},
		{
			.flags = MENU_FLAG_SUBMENU,
			.select = menu_select_item,
			.name = TXT_CURRENTS,
			.value = &currents_menu,
		},
		{
			.flags = 0,
			.select = menu_select_item,
			.name = TXT_PID,
			.value = ( void * ) MENU_PID,
		},
		{
			.flags = 0,
			.select = menu_select_item,
			.name = "CAN",
			.value = ( void * ) MENU_CAN,
		}
	},
	.num_entries = 4,
	.previous = NULL,
 };

menu_t main_submenu =
{
		.top_entry = 0,
		.current_entry = 0,
		.entry =
		{
				{
					.flags = 0,
					.select = menu_select_item,
					.name[0] = 0xAC,
					.name[1] = 0x00,
					.value = ( void * ) MENU_RETURN,
				},
				{
					.flags = 0,
					.select = menu_select_item,
					.name = TXT_TRACK,
					.value = ( void * ) MENU_TRACK,
				},
				{
					.flags = 0,
					.select = menu_select_item,
					.name = TXT_REGULATION,
					.value = ( void * ) MENU_REGULATION,
				}
		},
		.num_entries = 3,
		.previous = NULL,
};

menu_t main_menu =
{
	.top_entry = 0,
	.current_entry = 0,
	.entry =
	{
		{
			.flags = MENU_FLAG_SUBMENU,
			.select = menu_select_item,
			.name = TXT_MAIN,
			.value = &main_submenu,
		},
		{
			.flags = MENU_FLAG_SUBMENU,
			.select = NULL,
			.name = TXT_SETTINGS,
			.value = &settings_menu,
		},
		{
			.flags = MENU_FLAG_SUBMENU,
			.select = NULL,
			.name = TXT_EXIT,
			.value = &exit_menu,
		}
	},
	.num_entries = 3,
	.previous = NULL,
 };

menu_context_t menu_context = {
   .x_loc = 0,
   .y_loc = 0,
   .height = 4,
   .width = 14,
   .menu = NULL,
};

#endif /* MENU_CONFIG_H_ */
